<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Icons
 *
 * @author lucas
 */
class Icons {

    //put your code here

    private $_icons = array();

    public function __construct() {
        $this->_icons = array();
    }

    /**
     * List of Mime Types
     *
     * This is a list of mime types.  We use it to validate
     * the "allowed types" set by the developer
     *
     * @param	string
     * @return	string
     */
    public function icons_types($file = NULL) {

        if ($file != NULL) {
            if (count($this->_icons) == 0) {
                $icons = array();
                if (defined('ENVIRONMENT') AND is_file(APPPATH . 'config/' . ENVIRONMENT . '/icons.php')) {
                    include (APPPATH . 'config/' . ENVIRONMENT . '/icons.php');
                } elseif (is_file(APPPATH . 'config/icons.php')) {
                    include (APPPATH . 'config//icons.php');
                } else {
                    return FALSE;
                }

                $this->_icons = $icons;
                unset($icons);
            }
            $icon = strtolower(substr(strrchr($file, '.'), 1));
            if (count($this->_icons) > 0) {
                if (isset($this->_icons[$icon])) {
                    return base_img_adm('icons/' . $this->_icons[$icon]);
                } else {
                    return base_img_adm('icons/' . $this->_icons['text']);
                }
            } else {
                return NULL;
            }
        } else {
            return NULL;
        }
    }

}
